package com.whfc.emp.service.impl;

import com.whfc.emp.dao.WorkDailyReportMapper;
import com.whfc.emp.entity.WorkDailyReport;
import com.whfc.emp.service.WorkDailyReportService;
import com.whfc.entity.dto.Apply.rep.DailyReportDisplayRep;
import com.whfc.entity.dto.Apply.rep.WorkDailyReportDTO;
import com.whfc.entity.dto.Apply.req.AppEntryApplicationReq;
import com.whfc.entity.dto.Apply.req.WorkDailyReportQueryReq;
import org.apache.dubbo.config.annotation.DubboService;

import javax.annotation.Resource;
import java.util.List;

/**
 * 工作日报Service实现类
 */
@DubboService(interfaceClass = WorkDailyReportService.class, version = "1.0.0",timeout = 30000)
public class WorkDailyReportServiceImpl implements WorkDailyReportService {

    @Resource
    private WorkDailyReportMapper workDailyReportMapper;

    @Override
    public int addReport(WorkDailyReport report) {
        return workDailyReportMapper.insert(report);
    }

    @Override
    public int addReportSelective(WorkDailyReport report) {
        return workDailyReportMapper.insertSelective(report);
    }

    @Override
    public WorkDailyReport getById(Long id) {
        return workDailyReportMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<WorkDailyReport> getByPlanId(Long planId) {
        return workDailyReportMapper.selectByPlanId(planId);
    }

    @Override
    public List<WorkDailyReport> getByReporter(Long reporterId) {
        return workDailyReportMapper.selectByReporter(reporterId);
    }

    @Override
    public int updateReport(WorkDailyReport report) {
        return workDailyReportMapper.updateByPrimaryKey(report);
    }

    @Override
    public int updateReportSelective(WorkDailyReport report) {
        return workDailyReportMapper.updateByPrimaryKeySelective(report);
    }

    @Override
    public int deleteById(Long id) {
        return workDailyReportMapper.deleteByPrimaryKey(id);
    }

    @Override
    public List<DailyReportDisplayRep> queryHarvestReport(WorkDailyReportQueryReq req) {

        return workDailyReportMapper.queryHarvestReport(req);
    }

    @Override
    public List<DailyReportDisplayRep> queryMyDailyReport(WorkDailyReportQueryReq req) {
        return workDailyReportMapper.queryMyDailyReport(req);
    }

    @Override
    public List<WorkDailyReportDTO> selectReportList(AppEntryApplicationReq req) {
        return workDailyReportMapper.selectReportList(req);
    }
}